<script language="javascript" src="<?php echo JQUERYUI ?>jquery.ui.mouse.min.js"></script>
<script language="javascript" src="<?php echo JQUERYUI ?>jquery.ui.draggable.min.js"></script>
<script language="javascript" src="<?php echo JQUERYUI ?>jquery.ui.position.min.js"></script>
<script language="javascript" src="<?php echo JQUERYUI ?>jquery.ui.resizable.min.js"></script>
<script language="javascript" src="<?php echo JQUERYUI ?>jquery.ui.dialog.min.js"></script>
<script>
	$(document).ready(function() {
		$( ".date" ).datepicker();
		$( ".date" ).datepicker( "option", "dateFormat", "dd-mm-yy");
		$( "#tgl_awal" ).change(function(){
			location.href = "<?php echo PENJURU ?>list_result/"+$('#tgl_awal').val()+"/"+$('#tgl_akhir').val();
		});
		$( "#tgl_akhir" ).change(function(){
			location.href = "<?php echo PENJURU ?>list_result/"+$('#tgl_awal').val()+"/"+$('#tgl_akhir').val();
		});
		list_table = $('#list_penerimaan_jurusan').dataTable({
			"bFilter" : true,
			"bJQueryUI" : true,
			"aLengthMenu": [[10,25,50, 100, -1], [10,25,50,100, "Semua"]],
			"sPaginationType": "full_numbers",
			"oLanguage": {
				"sLengthMenu": "Menampilkan _MENU_ data",
				"sZeroRecords": "Belum ada data penerimaan kasir yang tersimpan",
				"sInfoFiltered": "(Hasil filter dari _MAX_ yang didapat)"
			}
		});
		$('#list_penerimaan_jurusan_filter').hide();
		$('#filter_asal').change(function(){
			asal = $('#filter_asal').val();
			tujuan = $('#filter_tujuan').val();
			tgl_awal = $('#tgl_awal').val();
			tgl_akhir = $('#tgl_akhir').val();
			location.href = "<?php echo PENJURU ?>list_result/"+tgl_awal+"/"+tgl_akhir+"/"+asal+"/"+tujuan;
		});
		$('#filter_tujuan').change(function(){
			asal = $('#filter_asal').val();
			tujuan = $('#filter_tujuan').val();
			tgl_awal = $('#tgl_awal').val();
			tgl_akhir = $('#tgl_akhir').val();
			location.href = "<?php echo PENJURU ?>list_result/"+tgl_awal+"/"+tgl_akhir+"/"+asal+"/"+tujuan;
		});
		$('#tgl_awal').change(function(){
			asal = $('#filter_asal').val();
			tujuan = $('#filter_tujuan').val();
			tgl_awal = $('#tgl_awal').val();
			tgl_akhir = $('#tgl_akhir').val();
			location.href = "<?php echo PENJURU ?>list_result/"+tgl_awal+"/"+tgl_akhir+"/"+asal+"/"+tujuan;
		});
		$('#tgl_akhir').change(function(){
			asal = $('#filter_asal').val();
			tujuan = $('#filter_tujuan').val();
			tgl_awal = $('#tgl_awal').val();
			tgl_akhir = $('#tgl_akhir').val();
			location.href = "<?php echo PENJURU ?>list_result/"+tgl_awal+"/"+tgl_akhir+"/"+asal+"/"+tujuan;
		});
	
		$( "#cetak_pdf" ).click(function(){
			tgl_awal = $( "#tgl_awal" ).val();
			tgl_akhir = $( "#tgl_akhir" ).val();
			asal = $( "#filter_asal" ).val();
			tujuan = $( "#filter_tujuan" ).val();
			location.href="<?php echo PENJURU ?>cetak_pdf/"+tgl_awal+"/"+tgl_akhir+"/"+asal+"/"+tujuan;
		});
		$( "#cetak_excel" ).click(function(){
			tgl_awal = $( "#tgl_awal" ).val();
			tgl_akhir = $( "#tgl_akhir" ).val();
			asal = $( "#filter_asal" ).val();
			tujuan = $( "#filter_tujuan" ).val();
			location.href="<?php echo PENJURU ?>cetak_excel/"+tgl_awal+"/"+tgl_akhir+"/"+asal+"/"+tujuan;
		});
	
	} );
</script>
<?php
$data['cur_parent_menu'] = 'laporan';
$data['cur_selected_menu'] = 'penjuru';
$this->load->view('template/menu_view', $data);
?>
<br/><br/><br/><br/><br/><br/>
<table width="1000" align="center">
	<tr>
		<td width="500">
			<?php
			$opt['SEMUA'] = 'SEMUA';
			$opt = array_merge($opt, $filter_cabang['nama_cabang']);
			?>
			Asal : <?php echo form_dropdown('cabang', $opt, $asal, 'id="filter_asal"') ?>
			Tujuan : <?php echo form_dropdown('cabang', $opt, $tujuan, 'id="filter_tujuan"') ?>
		</td>
		<td width="500" align="left">
			Tgl Awal : <input type="text" class="date" id="tgl_awal" value="<?php echo $tgl_awal ?>"/>
			Tgl Akhir : <input type="text" class="date" id="tgl_akhir" value="<?php echo $tgl_akhir ?>"/>
		</td>
	</tr>
</table>
<br/>
Cetak : <span class="clicked" id="cetak_pdf">PDF</span> <span class="clicked" id="cetak_excel">Excel</span>
<br/>
<table id="list_penerimaan_jurusan" width="100%" align="center" border="0">
	<thead>
		<tr>
			<th>No</th>
			<th>Jurusan</th>
			<th>Kode Jurusan</th>
			<th>Total Keberangkatan</th>
			<th>Total Tiket</th>
			<th>Total Tiket Void</th>
			<th>Okupasi</th>
			<th>Total Omset</th>
			<th>Total Discount</th>
			<th>Total Fee Agen</th>
			<th>Total Void</th>
			<th>Total Biaya Langsung</th>
			<th>Total Setor</th>
			<th>Total Biaya Awal</th>
			<th>Total Laba Kotor</th>
			<th>Action</th>
		</tr>
	</thead>
	<tbody>
		<?php for ($i = 0; $i < count($list_result); $i++) { ?>
			<tr>
				<td align="center"><?php echo ($i + 1) ?></td>
				<td align="center"><?php echo $list_result[$i]['asal'] . "-" . $list_result[$i]['tujuan'] ?></td>
				<td align="center"><?php echo $list_result[$i]['asal'] . "-" . $list_result[$i]['tujuan'] ?></td>
				<td align="center"><?php echo $total_keberangkatan[$i]['jumlah_keberangkatan'] ?></td>
				<td align="center"><?php echo $penerimaan_jurusan[$i]['total_penumpang'] ?></td>
				<td align="center"><?php echo $penerimaan_jurusan[$i]['tiket_void'] ?></td>
				<td align="center"><?php echo (($penerimaan_jurusan[$i]['total_penumpang'] / $penerimaan_jurusan[$i]['total_kapasitas']) * 100) . "%" ?></td>
				<td align="center">Rp. <?php echo number_format($penerimaan_jurusan[$i]['total_omset'], 0, ',', '.') ?></td>
				<td align="center">Rp. <?php echo number_format($penerimaan_jurusan[$i]['total_discount'], 0, ',', '.') ?></td>
				<td align="center">Rp. <?php echo number_format($penerimaan_jurusan[$i]['fee_agen'], 0, ',', '.') ?></td>
				<td align="center">Rp. <?php echo number_format($penerimaan_jurusan[$i]['total_void'], 0, ',', '.') ?></td>
				<td align="center">Rp. <?php echo number_format($penerimaan_jurusan[$i]['jumlah'], 0, ',', '.') ?></td>
				<td align="center">Rp. <?php echo number_format($penerimaan_jurusan[$i]['total_setoran'], 0, ',', '.') ?></td>
				<td align="center">Rp. 
					<?php
					if ($op_awal[$i]['jumlah'] == '') {
						echo number_format(0, 0, ',', '.');
					} else {
						echo number_format($op_awal[$i]['jumlah'], 0, ',', '.');
					}
					?>
				</td>
				<td align="center">Rp. <?php echo number_format($penerimaan_jurusan[$i]['total_laba'], 0, ',', '.') ?></td>
				<td align="center"><a href="<?php echo PENJURU ?>grafik_harian_omset_jurusan/<?php echo $list_result[$i]['asal'] ?>/<?php echo $list_result[$i]['tujuan'] ?>">Grafik Omset Bulanan</a>|
					<a href="<?php echo PENJURU ?>grafik_bulanan_omset_jurusan/<?php echo $list_result[$i]['asal'] ?>/<?php echo $list_result[$i]['tujuan'] ?>">Grafik Omset Tahunan</a>|
					<a href="<?php echo PENJURU ?>grafik_harian_produk_jurusan/<?php echo $list_result[$i]['asal'] ?>/<?php echo $list_result[$i]['tujuan'] ?>">Grafik Produktivitas Bulanan</a>|
					<a href="<?php echo PENJURU ?>grafik_bulanan_produk_jurusan/<?php echo $list_result[$i]['asal'] ?>/<?php echo $list_result[$i]['tujuan'] ?>">Grafik Produktivitas Tahunan</a></td>
			</tr>
		<?php }
		?>
	</tbody>
</table>